#include <cstdlib>
#include <fstream>
#include "DSMComun.h"
#include "SharedMemory2.h"
#include "MessageQueue.h"
#include "Semaphore.h"
#include "Sequence.h"
#include "ColaRemotaTransmisor.h"
#include "ColaRemotaReceptor.h"
#include "CPrinter.h"
#include "StringUtils.h"
#include "ProcessAux.h"

using ipc::CPrinter;
using ipc::MessageQueue;
using ipc::SharedMemory2;
using ipc::Semaphore;
using ipc::Sequence;

int main ()
{
    MessageQueue<PedidoDSM>::destroy( DSM_IPC_BASEFILE, COLA_PEDIDO_TOKEN );
    MessageQueue<TokenDSM>::destroy( DSM_IPC_BASEFILE, COLA_ENTREGA_TOKEN );
    MessageQueue<TokenDSM>::destroy( DSM_IPC_BASEFILE, COLA_LIBERAR_TOKEN );

    Semaphore::destroy( DSM_IPC_BASEFILE, MTX_CONT_PEDIDOS );

    SharedMemory2<int>::destroy( DSM_IPC_BASEFILE, SHM_CONT_PEDIDOS );

    std::string killCmd = "killall -9 ";
    system( ( killCmd + "dsmGestorEntrega" ).c_str() );
    system( ( killCmd + "dsmGestorPedidos" ).c_str() );
    system( ( killCmd + "gestorToken*" ).c_str() );

    return 0;
}
